<template>
    <view :style="themeColor">
        <view class="page" >
    <view class="flex flex-wrap align-center justify-between benben-position-layout flex detailsComment_flex_0"    :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
            <view   class='flex flex-wrap align-center detailsComment_fd0_0'   @tap.stop="handleJumpDiy" data-type="back" data-url="1"   >
        <image class='detailsComment_fd0_0_c0'  mode="aspectFit"  :src='STATIC_URL+"234.png"'></image>
</view>
<text class='detailsComment_fd0_1'  >{{$t('评论详情')}}</text>
    <view   class='flex flex-wrap align-center detailsComment_fd0_0'      >
        </view>

        </view>
<view :style="{height: (88+StatusBarRpx)+'rpx'}"  ></view>
<!---flex布局flex布局开始-->
 <view class="flex flex-direction flex-wrap align-stretch benben-flex-layout detailsComment_flex_1"    >
            <view   class='flex flex-direction flex-wrap align-stretch detailsComment_fd1_0'      >
            <view   class='flex flex-wrap align-center detailsComment_fd1_0_c0'      >
        <image class='detailsComment_fd1_0_c0_c0'  mode="aspectFill"  :src='dataDetails.goods_comment_detail.avatar'></image>
    <view   class='flex flex-direction flex-wrap align-stretch flex-sub detailsComment_fd1_0_c0_c1'      >
            <view   class='flex flex-wrap align-center justify-between'      >
        <text class='detailsComment_fd1_0_c0_c1_c0_c0'  >{{dataDetails.goods_comment_detail.nickname}}</text>
<text class='detailsComment_fd1_0_c0_c1_c0_c1'  >{{dataDetails.goods_comment_detail.create_time}}</text>
</view>
<view class='flex flex-wrap align-center'  >
    <template v-for="starNum in [1,2,3,4,5]">
        <image v-if="dataDetails.goods_comment_detail.star >= starNum" :key="starNum"  class='detailsComment_star1fd1_0_c0_c1_c1'  mode="aspectFit"  :src='STATIC_URL+"242.png"'></image>
        <image v-else :key="starNum"  class='detailsComment_star1fd1_0_c0_c1_c1'  mode="aspectFit"  :src='STATIC_URL+"169.png"'></image>
    </template>
</view>
</view>
</view>
<text class='detailsComment_fd1_0_c1'  >{{dataDetails.goods_comment_detail.content}}</text>
    <view   class='flex flex-wrap align-center detailsComment_fd1_0_c2'      >
            <template v-for = '(item,key0) in dataDetails.goods_comment_detail.thumb'>
    <view   class='flex flex-wrap align-center'       :key='key0'>
        <image class='detailsComment_fd1_0_c2_c0_c0'  mode="aspectFill"  :src='item' @tap="multiImagePreview(item,dataDetails.goods_comment_detail.thumb,'')" ></image>
</view>
    </template>
    
</view>
    <view   class='flex flex-wrap align-center justify-between detailsComment_fd1_0_c3'      >
        <text class='detailsComment_fd1_0_c0_c1_c0_c1'    v-if= " dataDetails.goods_comment_detail.key_name!='null'"  >{{dataDetails.goods_comment_detail.key_name}}</text>
    <view   class='flex flex-wrap align-center'   @tap.stop="conmentLikeFunc(gc_id)"   >
        <text class='detailsComment_fd1_0_c3_c1_c0'      >{{dataDetails.goods_comment_detail.likes_num}}</text>
<image class='detailsComment_fd1_0_c3_c1_c1'  mode="aspectFit"  :src='STATIC_URL+"172.png"'  v-if= "dataDetails.goods_comment_detail.is_likes=='1'"></image><image class='detailsComment_fd1_0_c3_c1_c1'  mode="aspectFit"  :src='STATIC_URL+"171.png"'  v-if= "dataDetails.goods_comment_detail.is_likes=='0'"></image>
</view>
</view>
</view>
    <view   class='flex flex-wrap align-center detailsComment_fd1_1'      >
        </view>
    <view   class='flex flex-wrap align-center detailsComment_fd1_2'    v-if= " dataDetails.goods_comment_reply_list.data.length>0"  >
        <image class='detailsComment_fd1_2_c0'  mode="aspectFit"  :src='STATIC_URL+"243.png"'></image>
<text class='detailsComment_fd1_2_c1'  >{{dataDetails.goods_comment_reply_list.total}}</text>
<text class='detailsComment_fd1_2_c2'  >{{$t('条回复')}}</text>
</view>
    <template v-for = '(item,key0) in dataDetails.goods_comment_reply_list.data'>
    <view   class='flex flex-wrap align-start detailsComment_fd1_3'       :key='key0'>
        <image class='detailsComment_fd1_0_c0_c0'  mode="aspectFill"  :src='item.avatar'></image>
    <view   class='flex flex-direction flex-wrap align-stretch flex-sub detailsComment_fd1_0_c0_c1'      >
        <text class='detailsComment_fd1_3_c1_c0'  >{{item.nickname}}</text>
<text class='detailsComment_fd1_3_c1_c1'  >{{item.create_time}}</text>
<text class='detailsComment_fd1_3_c1_c0'  >{{item.content}}</text>
</view>
</view>
    </template>
    
    <view   class='flex flex-wrap align-center detailsComment_fd1_4'      >
            <view   class='flex align-center flex-sub detailsComment_fd1_4_c0'      >
        <image class='detailsComment_fd1_4_c0_c0'  mode="aspectFit"  :src='STATIC_URL+"244.png"'></image>
<benben-input class='detailsComment_fd1_4_c0_c1'   type="text" :placeholder="$t('请输入')" confirm-type="done" :maxlength="240" placeholder-style="color:#999;font-size:28rpx"  v-model="content" />
</view>
<button class='detailsComment_fd1_4_c1'  @tap.stop="queryMessageFunc()"  >{{$t('发布')}}</button>
</view>
</view>
        
<!---flex布局flex布局结束-->
    
    
        </view>
    </view>
</template>
<script>
    import {validate} from '@/common/utils/validate.js'
    
    export default {
        components:{},
        
        
        data(){
			return {"dataDetails":{"goods_comment_detail":{"aid":"","type":"","thumb":[],"create_time":"","content":"","star":"","avatar":"","nickname":"","key_name":"","is_likes":"","likes_num":""},"goods_comment_reply_list":{"total":"","per_page":"","current_page":"","last_page":"","data":[]}},"content":"","dataBack":{"is_collection":""},"gc_id":"62"};
		},
		computed:{
            themeColor() {
              return this.$store.getters.themeColor
            },
                         isLogin() {
      return this.$store.state.token == '' ? false : true;
    }
		},
		watch:{},
		onLoad(options){
            let {gc_id}=options
if (gc_id !== undefined) this.gc_id = gc_id
this.queryDetailsFunc()
		},
        onUnload() {
                
        },
		onReady(){
            
		},
		onShow(){
            
		},
		onHide(){
            
		},
		onResize(){
            
		},
		onPullDownRefresh(){
            this.queryDetailsFunc()
		},
		onReachBottom(e){
            
		},
		onPageScroll(e){
            
		},
		methods:{
                            //点赞
                async conmentLikeFunc(id){
                        if( this.isLogin===true){
            //请求方法
    //数据验证
    
  let datadataBack = await this.$api.dbPost(global.apiUrls.post641ae9cf8abed, {
    gc_id:id
  });
  if(!datadataBack) return
  if (datadataBack.data.code != 1) {
    this.$message.info(datadataBack.data.msg);
    return
  } 
  let infodataBack = datadataBack.data;
  this.dataBack = infodataBack.data
  
                    this.queryDetailsFunc()
    }
    else{
                            this.$message.info('请先登录');
                this.toLoginDiy();
    }
                },
                //商品评论-回复评论
                async queryMessageFunc(){
                        if( this.isLogin===true){
                    if(!validate(this.content,'require')){
                 this.$message.info(global.i18n.t('请输入评论'));
                 return false;
            }
    if(this.content.trim()==''){
						this.$message.info('请输入评论');
						return false;
					}
    //请求方法
    //数据验证
    
  let data641ae6a3510c7 = await this.$api.get(global.apiUrls.post641ae6a3510c7, {
    gc_id:this.gc_id,content:this.content
  });
  
  if (data641ae6a3510c7.data.code != 1) {
    this.$message.info(data641ae6a3510c7.data.msg);
    return
  } 
  
  
  
                    this.$message.info('评论发布成功');
   this.content = '';
                    this.queryDetailsFunc()
    }
    else{
                            this.$message.info('请先登录');
                this.toLoginDiy();
    }
                },
                //商品评论-获取单条评论详情
                async queryDetailsFunc(){
                        //请求方法
    //数据验证
    
  let datadataDetails = await this.$api.get(global.apiUrls.post641ae646bde4a, {
    gc_id:this.gc_id
  });
  
  if (datadataDetails.data.code != 1) {
    this.$message.info(datadataDetails.data.msg);
    return
  } 
  let infodataDetails = datadataDetails.data;
  this.dataDetails = infodataDetails.data
  
                }
		}
    };
</script> 
<style lang="scss" scoped>
           .page{
            width: 100vw;
            overflow-x: hidden;
            min-height: calc(100vh - var(--window-bottom));
            background:#fff;background-size: 100% auto;
        }
    .detailsComment_flex_0{
        background:#fff;width:750rpx;height:88rpx;overflow:hidden;z-index:10;top:0rpx;background-size:100% auto !important;
    }
    .detailsComment_fd0_1{
        color:#333333;font-size:36rpx;font-weight:500;line-height:50rpx;
    }
    .detailsComment_fd0_0_c0{
        width:20rpx;height:36rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:0rpx 0rpx 0rpx 32rpx;
    }
    .detailsComment_fd0_0{
        width:100rpx;height:88rpx;
    }
    .detailsComment_flex_1{
        margin:0rpx 0rpx 130rpx 0rpx;
    }
    .detailsComment_fd1_4_c1{
        background:var(--benbenbgColor7);border-radius:44rpx 44rpx 44rpx 44rpx;font-size:24rpx;color:var(--benbenFontColor3);width:104rpx;height:48rpx;line-height:48rpx;margin:0rpx 32rpx 0rpx 0rpx;
    }
    .detailsComment_fd1_4_c0_c1{
        color:var(--benbenFontColor0);font-size:28rpx;font-weight:400;line-height:40rpx;width:100%;
    }
    .detailsComment_fd1_4_c0_c0{
        width:26rpx;height:24rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:0rpx 8rpx 0rpx 0rpx;
    }
    .detailsComment_fd1_4_c0{
        background:#F8F8F8;border-radius:36rpx 36rpx 36rpx 36rpx;padding:16rpx 32rpx 16rpx 32rpx;margin:0rpx 32rpx 0rpx 32rpx;
    }
    .detailsComment_fd1_4{
        background:var(--benbenbgColor1);position:fixed;bottom:calc(0rpx + var(--window-bottom));left:0rpx;width:750rpx;padding:10rpx 0rpx 40rpx 0rpx;background-size:100% auto;
    }
    .detailsComment_fd1_3_c1_c1{
        color:#999999;font-size:22rpx;font-weight:400;line-height:30rpx;margin:0rpx 0rpx 16rpx 0rpx;
    }
    .detailsComment_fd1_3_c1_c0{
        color:#333333;font-size:28rpx;font-weight:400;line-height:40rpx;
    }
    .detailsComment_fd1_3{
        margin:32rpx 0rpx 40rpx 0rpx;padding:0rpx 32rpx 0rpx 32rpx;
    }
    .detailsComment_fd1_2_c2{
        color:#202020;font-size:32rpx;font-weight:500;line-height:45rpx;
    }
    .detailsComment_fd1_2_c1{
        color:#202020;font-size:32rpx;font-weight:500;line-height:45rpx;margin:0rpx 0rpx 0rpx 16rpx;
    }
    .detailsComment_fd1_2_c0{
        width:32rpx;height:30rpx;border-radius:0rpx 0rpx 0rpx 0rpx;
    }
    .detailsComment_fd1_2{
        border-bottom:1px solid rgba(238, 238, 238, 1);padding:32rpx 0rpx 24rpx 0rpx;margin:0rpx 32rpx 0rpx 32rpx;
    }
    .detailsComment_fd1_1{
        background:var(--benbenbgColor5);background-size:100% auto !important;height:20rpx;
    }
    .detailsComment_fd1_0_c3_c1_c1{
        width:24rpx;height:26rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:0rpx 0rpx 0rpx 21rpx;
    }
    .detailsComment_fd1_0_c3_c1_c0{
        color:var(--benbenFontColor0);font-size:22rpx;font-weight:400;line-height:33rpx;
    }
    .detailsComment_fd1_0_c3{
        margin:0rpx 0rpx 0rpx 4rpx;padding:20rpx 0rpx 29rpx 0rpx;
    }
    .detailsComment_fd1_0_c2_c0_c0{
        width:226rpx;height:226rpx;border-radius:8rpx 8rpx 8rpx 8rpx;margin:0rpx 0rpx 20rpx 4rpx;
    }
    .detailsComment_fd1_0_c2{
        margin:32rpx 0rpx 12rpx 0rpx;
    }
    .detailsComment_fd1_0_c1{
        color:var(--benbenFontColor0);font-size:28rpx;font-weight:400;line-height:40rpx;margin:0rpx 0rpx 0rpx 4rpx;
    }
    .detailsComment_star1fd1_0_c0_c1_c1{
        height:18rpx;margin:0rpx 5rpx 0rpx 5rpx;width:18rpx;
    }
    .detailsComment_star1fd1_0_c0_c1_c1{
        width:18rpx;height:18rpx;border-radius:0rpx 0rpx 0rpx 0rpx;margin:0rpx 5rpx 0rpx 5rpx;
    }
    .detailsComment_fd1_0_c0_c1_c0_c1{
        color:var(--benbenFontColor2);font-size:24rpx;font-weight:400;line-height:33rpx;
    }
    .detailsComment_fd1_0_c0_c1_c0_c0{
        color:var(--benbenFontColor0);font-size:28rpx;font-weight:400;line-height:40rpx;
    }
    .detailsComment_fd1_0_c0_c1{
        margin:0rpx 0rpx 0rpx 16rpx;
    }
    .detailsComment_fd1_0_c0_c0{
        width:56rpx;height:56rpx;border-radius:28rpx 28rpx 28rpx 28rpx;
    }
    .detailsComment_fd1_0_c0{
        margin:0rpx 0rpx 0rpx 4rpx;padding:32rpx 0rpx 24rpx 0rpx;
    }
    .detailsComment_fd1_0{
        padding:0rpx 32rpx 0rpx 28rpx;
    }
</style>